<?php
namespace app\admin\model;

use think\Model;
use think\facade\Config;
class Subscribe extends Model
{   
	 protected $connection = 'publicdata';
	/*查询数据 */
	public function get_data($page,$limit){
	    $start=($page-1)*$limit;
		$list=Subscribe::where([['status','=',1]])->order('id', 'desc')->limit($start,$limit)->select()->toArray();
        $data['count']=Subscribe::count();
        $data['list']=$list;

        return $data;
		
	}
	
	/*删除假动作实际为修改操作*/
	public function delete_data($id){
        $data = Subscribe::get($id);
        if($data['status']!=1){
        	$result=['status'=>'0','msg'=>'无需操作'];
	        return json($result);
        }
		$data->status = '2';
		$result=$data->save();
		return $result;
	}

	/*查询一条*/
	public function get_one_data($id){
        $data = Subscribe::get($id);
        
		return $data;
	}
}
 